<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>搜索框</title>
  <style>
    .search-container {
      display: flex;
      max-width: 600px;
      margin: 20px auto;
    }
    .search-input {
      flex: 1;
      padding: 10px;
      border: 1px solid #ccc;
      border-radius: 4px 0 0 4px;
      font-size: 16px;
    }
    .search-button {
      padding: 10px 20px;
      background-color: #007bff;
      color: white;
      border: none;
      border-radius: 0 4px 4px 0;
      cursor: pointer;
      font-size: 16px;
    }
    .search-button:hover {
      background-color: #0056b3;
    }
  </style>
</head>
<body>
  <div class="search-container">
    <input type="text" class="search-input" placeholder="请输入搜索内容...">
    <button class="search-button">搜索</button>
  </div>

  <script>
    document.querySelector('.search-button').addEventListener('click', function() {
      const query = document.querySelector('.search-input').value;
      if (query) {
        alert('搜索内容：' + query);
        // 这里可以添加实际的搜索逻辑
      } else {
        alert('请输入搜索内容');
      }
    });
  </script>
</body>
</html>
